﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Basic.Cluster.Manager
{
    public class ConsulConfig
    {
        /// <summary>
        /// 注册本地服务的信息
        /// </summary>
        public ServiceInfo LocalServiceInfo { get; set; }

        /// <summary>
        /// Consul地址(秒)
        /// </summary>
        public string ConsulAddress { get; set; }

        /// <summary>
        /// 健康检测频率(秒)
        /// </summary>
        public int? HealthInterval { get; set; } = 15;

        /// <summary>
        /// 健康检查超时
        /// </summary>
        public int? HealthTimeout { get; set; } = 5;

        public class ServiceInfo
        {
            public string Id { get => $"{Name}-{IP}-{Port}"; }
            public string Name { get; set; }
            public string IP { get; set; }
            public ushort Port { get; set; }
            public string HealthUrl { get; set; }
        }

    }
}